package com.sun.lib.clip;
/*
 *
 * #                                                   #
 * #                       _oo0oo_                     #
 * #                      o8888888o                    #
 * #                      88" . "88                    #
 * #                      (| -_- |)                    #
 * #                      0\  =  /0                    #
 * #                    ___/`---'\___                  #
 * #                  .' \\|     |# '.                 #
 * #                 / \\|||  :  |||# \                #
 * #                / _||||| -:- |||||- \              #
 * #               |   | \\\  -  #/ |   |              #
 * #               | \_|  ''\---/''  |_/ |             #
 * #               \  .-\__  '-'  ___/-. /             #
 * #             ___'. .'  /--.--\  `. .'___           #
 * #          ."" '<  `.___\_<|>_/___.' >' "".         #
 * #         | | :  `- \`.;`\ _ /`;.`/ - ` : | |       #
 * #         \  \ `_.   \_ __\ /__ _/   .-` /  /       #
 * #     =====`-.____`.___ \_____/___.-`___.-'=====    #
 * #                       `=---='                     #
 * #     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   #
 * #                                                   #
 * #               佛祖保佑         永无BUG              #
 * #                                                   #
 */

import android.graphics.Path;

/**
 * Created by ESSC07 on 2021/10/12.
 */
public class ClipPathManager {
    protected final Path path = new Path();

    private ClipPathCreator createClipPath = null;

    public ClipPathManager() {
    }

    /**
     * 设置裁剪布局
     * @param width
     * @param height
     */
    public void setupClipLayout(int width, int height) {
        path.reset();
        Path clipPath = null;
        if (createClipPath != null) {
            clipPath = createClipPath.createClipPath(width, height);
        }
        if (clipPath != null) path.set(clipPath);
    }

    public Path getClipPath() {
        return path;
    }

    public void setClipPathCreator(ClipPathCreator createClipPath) {
        this.createClipPath = createClipPath;
    }

    public interface ClipPathCreator {
        Path createClipPath(int width, int height);
    }
}
